--- See 'https://github.com/Frege/frege/issues/271 Issue #271'
--- - Compiler issues a guard-may-fail warning, despite default case available.
--- - Should print Nothing, but dies of tuple pattern not matched

--- Turns out that the pattern binding in the first clause of 'readDriveShare' morphs to
--- > readDriveShare (x:xs) = let u = (['f', 'g']) in 
--- >            case u of (a,_) -> case u of (_,b) | x == '/' = Just (x:a,b)  
--- and this wrongly attaches the guard to the wrong case clause.

--- Solution: drop the special handling of 
--- > let a = case ... in ...
--- It didn't play well with laziness anyway.

module tests.comp.Issue271 where


readDriveShare (x:xs) | x == '/' = b
    where
        (a,b) = (['f'], undefined)
        -- a = case  (['f'],['g']) of (a,_) = a
        -- b = case  (['f'],['g']) of (_,b) = b
        
readDriveShare _ = "Ok"

main = println $ readDriveShare (toList "file")

simpler (s:ss) | s == "foo" = (b,a) where (a,b) = (42,true)
simpler _ = (false, 0)